package chapter9;

public class Demo4 {
    public static void  main(String[] args) {
        System.out.println(getEvenNum(2,32));
    }

    /**
     * 获取num1-num2之间任意一个偶数
     * @param num1
     * @param num2
     * @return
     */
    public static int getEvenNum(double num1,double num2){
        int num = (int)(num1 + Math.random()*(num2-num1));
        if(num %2 !=0){
            num = num+1;
        }
        return num;
    }
}
